<include file="public@head"/>
<!--公共样式-->
<link rel="stylesheet" href="__STATIC__/calendar/css/reset.css" />
<!--主要样式-->
<link rel="stylesheet" type="text/css" href="__STATIC__/calendar/css/simple-calendar.css">
<link rel="stylesheet" href="__STATIC__/calendar/css/calendar.css" />
<link type="text/css" rel="stylesheet" href="__STATIC__/user_center/css/basic.css" />
<title>{$user_name}的课表</title>
</head>
<body>
<!--header 开始-->
  <header style="width:100%;">
    <div class="header" style="width:100%;"> 
		<!-- <a class="new-a-back" href="javascript:history.back();"><span style="text-indent:0px;"><返回</span></a> -->
		<h2>{$user_name}的课表</h2>
		<!-- <a class="new-a-jd" id="trigger-overlay" href="javascript:void(0)"> <span>导航菜单</span> </a> -->
    </div>
  </header>
  <!--header 结束-->
<!-- 微信分享链接缩略图 -->
<div style="display:none;"><img style="width:300px,height:300px;" src="__TMPL__/public/assets/images/favicon.png" alt=""></div>
	<div>
		<div class="row-fluid">
			<div class="span12">
				<div class="inner">
					<div id='calendar' class="sc-calendar">
						<div class="sc-header">
							<div class="sc-title">
								<div class="year"><span class="sc-select-year" name=""></span>年</div>
								<div class="month">
									<div class="arrow sc-mleft"></div>
									<div class="monthdiv">
										<span class="sc-select-month" name=""></span>
									</div>
									<div class="arrow sc-mright"></div>
								</div>
							</div>
							<div class="sc-week"></div> 
						</div>
						<div class="sc-body">
							<div class="sc-days"></div>
						</div>
					</div>
					<div class="announcement">
						<ul class="matter">
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div style="40px;">
	</div>
<!--footer 开始-->
<if condition="cmf_get_current_admin_id()">
<include file="portal/wxview@footer">
</if>
  <!--footer end-->
</body>
<script type="text/javascript" src="__STATIC__/calendar/js/simple-calendar.js"></script>
<script type="text/javascript" src="__STATIC__/calendar/js/hammer-2.0.8-min.js"></script>
<script type="text/javascript">
	var myCalendar = new SimpleCalendar('#calendar');
	$(function(){
		var monthCH = $('.sc-select-month').text();
		$(".sc-mleft").click(function(){
			myCalendar.subMonth();
		   var year = $('.sc-select-year').text();
		   var monthCH = $('.sc-select-month').text();
		   var month = SimpleCalendar.prototype.languageData.months_CH.indexOf(monthCH)+1;
	   })
		$(".sc-mright").click(function(){
			myCalendar.addMonth();
			var year = $('.sc-select-year').text();
			var monthCH = $('.sc-select-month').text();
			var month = SimpleCalendar.prototype.languageData.months_CH.indexOf(monthCH)+1;
		})
	});
	
	//滑动切换
	var myElement = document.getElementById('calendar');
　　  			var hammer = new Hammer(myElement);
	hammer.on("swipeleft", function (ev) {
		myCalendar.addMonth();
	});
	hammer.on("swiperight", function (ev) {
		myCalendar.subMonth();
	});
	
	//添加标记
	var mark = {$timetable_data};
	myCalendar._defaultOptions.mark=mark;
	myCalendar.update();
	
	
	
	//显示当天的活动在初始化mark之后
	//初始化今天的活动
	announceList($('.sc-today'));
	//有标记的日期点击事件
	$('#calendar').on("click", '.sc-selected', function() {
		announceList($(this));
	});
	
	//显示选择日期当天的活动
	function announceList(v){
		if(v.children().hasClass('sc-mark-show')){
			var year = $('.sc-select-year').text();
			var monthCH = $('.sc-select-month').text();
			var day = v.children()[1].innerText;
			var month = SimpleCalendar.prototype.languageData.months_CH.indexOf(monthCH)+1;
			var date = year + '-' + month + '-' + day;
			var content = mark[date];
			var matterHtml='';
			for(var i=0;i<content.length;i++){
				matterHtml +='<li class="announceItem"><div><div class="fl announceImg">'
					+'<img class=" " src="__STATIC__/calendar/images/content.png"></div>'
					+'<p class="announceContent">'+content[i].title+'</p>'
					+'<p class="announceContent">'+content[i].startTime+' - '+content[i].endTime+'</p></div></li>';
			}
			$('.matter').html(matterHtml);
		}else{
			var matterHtml=''
			matterHtml +='<li class="announceItem"><div><p class="announceContent">当前日期暂无课程</p></div></li>';
			$('.matter').html(matterHtml);
		}
	}
	
</script>
</html>
